//#include "TreeView.h"
////#include "World.h"
//#include "MainSubject.h"
//#include "Event.h"
//
//TreeView::TreeView()
//{
//	MainSubject::GetInstance().AttachObserver(this);
//}
//TreeView::~TreeView()
//{
//
//}
//bool TreeView::Setup(HWND a_hWnd, HINSTANCE a_hInst)
//{
//	RECT rect;
//
//	GetClientRect(a_hWnd, &rect);
//	m_hWnd = CreateWindowEx(NULL, WC_TREEVIEW, "Tree View", WS_VISIBLE | WS_VSCROLL | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS, 0, 400, rect.right, rect.bottom, a_hWnd, NULL, a_hInst, NULL);
//	if(m_hWnd == NULL)
//	{
//		return false;
//	}
//	SetupImages();
//	
//	m_terrain = AddItem("Terrain", TVI_ROOT, 0);
//	m_octree = AddItem("Octree", m_terrain, 0);
//	AddItem("Also Awesomeness", m_octree, 1);
//	m_occlusion = AddItem("Occlusion", m_terrain, 0);
//	AddItem("Awesomeness", m_occlusion, 1);
//
//	m_lights = AddItem("Lights", TVI_ROOT, 0);
//	AddItem("Directional", m_lights, 0);
//	m_omni = AddItem("Omni", m_lights, 0);
//	AddItem("Spot", m_lights, 0);
//
//	m_players = AddItem("Players", TVI_ROOT, 0);
//	m_dwarf = AddItem("Dwarf", m_players, 0);
//	AddItem("Mesh", m_dwarf, 1);
//	AddItem("Tiger", m_players, 1);
//	AddItem("Bird", m_players, 1);
//
//	m_particles = AddItem("Particle Emitters", TVI_ROOT, 0);
//	AddItem("Fire", m_particles, 1);
//	AddItem("Rain", m_particles, 1);
//	AddItem("Electric", m_particles, 1);
//
//	m_sounds = AddItem("Sound Emitters", TVI_ROOT, 0);
//	AddItem("Fire", m_sounds, 1);
//	AddItem("Jaguar", m_sounds, 1);
//	AddItem("Drum Loop", m_sounds, 1);
//
//
//	return true;
//}
//void TreeView::SetupImages()
//{
//	HIMAGELIST hImages = ImageList_Create(16, 16, ILC_COLORDDB | ILC_MASK, 2, 4);
//
//	HICON hIcon = (HICON)LoadImage(NULL, "media/appDefault.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
//	if(hIcon == NULL)
//	{
//		return;
//	}
//	ImageList_AddIcon(hImages, hIcon);
//
//	hIcon = (HICON)LoadImage(NULL, "media/folderOpen.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
//	if(hIcon == NULL)
//	{
//		return;
//	}
//
//	ImageList_AddIcon(hImages, hIcon);
//
//	TreeView_SetImageList(m_hWnd, hImages, TVSIL_NORMAL);
//}
//HTREEITEM TreeView::AddItem(char* a_label, HTREEITEM a_parent, int a_imageIndex)
//{
//	TVITEMEX tv;
//	TVINSERTSTRUCT tvi;
//
//	ZeroMemory(&tv, sizeof(TVITEMEX));
//	tv.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
//	tv.pszText = a_label;
//	tv.iImage = a_imageIndex;
//	tv.iSelectedImage = a_imageIndex;
//
//	tvi.itemex = tv;
//	tvi.hParent = a_parent;
//
//	return (HTREEITEM)SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvi);
//}
//bool TreeView::CheckSelection(char* a_pLabel)
//{
//	HTREEITEM hti;
//	ZeroMemory(&hti, sizeof(HTREEITEM));
//	hti = TreeView_GetSelection(m_hWnd);
//	if(hti == NULL)
//		return false;
//
//	char buffer[256];
//	TVITEMEX tv;
//	ZeroMemory(&tv, sizeof(TVITEMEX));
//	tv.mask = TVIF_TEXT;
//	tv.hItem = hti;
//	tv.pszText = buffer;
//	
//	SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&tv);
//	return !strcmp(buffer, a_pLabel);
//}
//void TreeView::Update()
//{
//	if(CheckSelection("Omni"))
//	{
//		//World::GetInstance().SetSelectedObject();
//	}
//
//}
//void TreeView::Notify(const SEvent& a_event)
//{
//	/////////////////////////////////////////////
//	//Note: 
//	//The string of if statements are slightly hacky, but the only way to work with hashes
//	//They all have early out returns at the end of their statement, this is because only
//	//one message can be sent at a time, so once it is processed, no need to check for
//	//other messages.
//	/////////////////////////////////////////////
//
//	if(a_event.GetId() == MainSubject::GetInstance().Hash("Light") || a_event.GetId() == MainSubject::GetInstance().Hash("New Player"))
//	{
//		//Add Light to items
//		AddItem("Omni Light", m_omni, 1);
//		return;
//	}
//	if(a_event.GetId() == MainSubject::GetInstance().Hash("Player") || a_event.GetId() == MainSubject::GetInstance().Hash("New Light"))
//	{
//		//Add Player to items
//		AddItem("Dwarf Player", m_players, 1);
//		return;
//	}
//}